const Router = require('koa-router')
const deleteaddress = new Router()
//！拿到前端的数据
//数据库连接池
const pg = require('pg');
let psql = new pg.Pool({
    database: 'running',
    user: 'run',
    port: 5432,
    host: '82.157.94.115',
    password: 'z12345678',
    max: 2
})

deleteaddress.post('/deleteaddress', async ctx => {
    let {name} = ctx.request.body;
    let deleteContentPostgresql = `delete from address where name = '${name}'`;
    let content = await psql.query(deleteContentPostgresql);

    if (content.rowCount > 0)
        ctx.body = {
            content
        };


})

module.exports = deleteaddress